﻿' TouchFlo Detacher
' Copyright (C) 2009, Avian Waves Software
' SEE LICENSE.TXT for software licensing information regarding original TouchFlo Detacher source code and binaries
' SEE OpenNetCF_LICENSE.TXT for licensing information regarding OpenNetCF binaries

Public Class KeyAssigner
  Private Sub KeyAssigner_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
    Me.ComboBoxQuick.SelectedIndex = 0
  End Sub

  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim sf As New SelectFile
    If sf.ShowDialog <> Windows.Forms.DialogResult.Cancel Then
      Me.TextBoxApp.Text = sf.FileName
    End If
  End Sub

  Private Sub MenuItemOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemOK.Click
    Me.DialogResult = Windows.Forms.DialogResult.OK
    Me.Close()
  End Sub

  Private Sub MenuItemCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemCancel.Click
    Me.DialogResult = Windows.Forms.DialogResult.Cancel
    Me.Close()
  End Sub

  Private Function GetAppPath()
    Return System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)
  End Function

  Private Sub ComboBoxQuick_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles ComboBoxQuick.SelectedIndexChanged
    Select Case Me.ComboBoxQuick.SelectedIndex
      Case 1
        Me.TextBoxApp.Text = Me.GetAppPath & "\TFDShowTF.exe"
        Me.TextBoxText.Text = "TouchFlo"
      Case 2
        Me.TextBoxApp.Text = Me.GetAppPath & "\TFDHideTF.exe"
        Me.TextBoxText.Text = "Today"
      Case 3
        Me.TextBoxApp.Text = Me.GetAppPath & "\TFDCloseTF.exe"
        Me.TextBoxText.Text = "Today"
    End Select
  End Sub
End Class